%function [t,x,y,a,s]=read_crappy_eyelink_shit(filename)
clear 
clc
cd 'C:\Data\data_eyelink2\from_LOR\PIF\AAL.2005_12_07_PIF_jan_06'
filename='AAL01.ASC';

[t,x,y,a,c] =textread(filename,'%s %s %s %s %s'); disp(['file: ' filename ' loaded'])
clear c;
t(strcmp(t, '.') )={'0.0'}; t=str2num(char(t ));disp('str2num(t )')
x(strcmp(x, '.') )={'0.0'}; x=str2num(char(x ));disp('str2num(x )')
y(strcmp(y, '.') )={'0.0'}; y=str2num(char(y ));disp('str2num(y )')
a(strcmp(a, '.') )={'0.0'}; a=str2num(char(a ));disp('str2num(a )')
if t(end)==0
    t(end)=[];
    x(end)=[];
    y(end)=[];
    a(end)=[];
end
clf; hold on
plot(t,x,'b')
plot(t,y,'r')

    t(end,:)=[];x(end,:)=[];y(end,:)=[];a(end,:)=[];
end




length(x)
plot(time,x)
data=textread(filename);

fclose(fp);


%data=fscanf(fp,'%f',inf)];
count=5
fseek(fp,0,1);
lengthoffile=ftell(fp);
fseek(fp,0,-1);
status(0);
mat=[];
while count>0
    [ret, count]=fscanf(fp, '%f', 4);
    if(count==1)
        mat=[mat;ret 0.0 0.0 0.0];
    else
        mat=[mat;ret'];
    end   
    fgetl(fp);
    status(ftell(fp)/lengthoffile)
end
status(-1)
fclose(fp);